package com.seocoo.worker.base.http;

import android.text.TextUtils;

import com.seocoo.worker.base.refresh.IPageList;

import java.util.List;

public class BasePageRsp<T> implements IPageList<T> {
    private String code;

    private String msg;

    //当前页
    private int page;

    //总条数
    private int total;

    private List<T> rows;
    private List<T> data;
    private int totalPage;

    public boolean success() {

        if (TextUtils.equals("200", this.code)) {
            return true;
        }
        return false;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public List<T> getRows() {
        return rows;
    }

    public void setRows(List<T> rows) {
        this.rows = rows;
    }

    @Override
    public int getNowPage() {
        return page;
    }

    @Override
    public int getTotalPage() {
        return totalPage;
    }

    @Override
    public List<T> getRootArray() {
        return rows == null ? data : rows;
    }
}
